<template>
  <div class="container">
    <topTitle
      :titleText="projectName"
      :back="true"
      :status="statusDesc"
      @gobackTriser="goBack"
    >
    </topTitle>
    <div class="mainCon">
      <el-form
        :model="formData"
        :rules="formRules"
        ref="formData"
        label-width="164px"
        class="demo-ruleForm"
      >
        <el-row>
          <el-col>
            <div class="secondaryTitle secondaryTitleTheme mrB30">
              项目基本信息
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content bg-purple">
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="projectName" label="项目名称：">
                    <el-input
                      v-model.trim="formData.projectName"
                      placeholder="请输入项目名称"
                      class="proInputWidth"
                      @blur="validProName"
                      clearable
                      disabled
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    prop="license"
                    label="施工许可证："
                    :rules="
                      isNeedLicense == 1
                        ? {
                            required: true,
                            message: '施工许可证不能为空',
                            trigger: 'blur ',
                          }
                        : { required: false, trigger: 'blur' }
                    "
                  >
                    <el-input
                      v-model.trim="formData.license"
                      placeholder="请输入施工许可证号,可录入多个，用“，”隔开"
                      class="proInputWidth"
                      @blur="validProName"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="projectStatus" label="项目状态：">
                    <p>{{ statusDesc }}</p>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item prop="areaId" label="所属区域：">
                    <p>{{ areaName }}</p>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item prop="industryId" label="所属行业：">
                    <p>{{ industryName }}</p>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item prop="investment" label="投资类别：">
                    <p>{{ investmentDesc }}</p>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="projectCost" label="工程造价：">
                    <p>{{ total }}元</p>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item prop="startDate" label="开工日期：">
                    <el-date-picker
                      type="date"
                      placeholder="请选择"
                      v-model="formData.startDate"
                      class="proInputWidth"
                      clearable
                      value-format="yyyy-MM-dd"
                    ></el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="constructionCycle" label="建设周期：">
                    <el-input
                      v-model.trim="formData.constructionCycle"
                      placeholder="请输入时长，单位为：天"
                      style="margin-right: 8px"
                      class="dialogSingleHalfInp"
                      clearable
                    ></el-input>
                    天
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    prop="detailAddress"
                    label="项目部详细地址："
                    :rules="
                      isNeedAddress == 0
                        ? [{ required: false }]
                        : formRules.detailAddress
                    "
                  >
                    <div style="position: relative">
                      <el-input
                        v-model.trim="formData.detailAddress"
                        maxlength="200"
                        placeholder="请输入项目部详细地址，并在地图上确定详细位置"
                        class="proInputWidth"
                        id="suggestId"
                        @blur="hideMap"
                        ref="inputDetailAdr"
                      ></el-input>
                      <div
                        style="
                          width: 62%;
                          height: 33px;
                          background: #fff;
                          position: absolute;
                          top: 3px;
                          left: 3px;
                          z-index: 10;
                          opacity: 0;
                        "
                        @click="showMap"
                        v-if="isShowBox"
                      ></div>
                      <div
                        id="searchResultPanel"
                        style="
                          border: 1px solid #c0c0c0;
                          width: 150px;
                          height: auto;
                          display: none;
                        "
                      ></div>
                    </div>
                    <el-row class="row-padding-bottom" v-if="isShowMap">
                      <el-col :span="24" class="col-position">
                        <div
                          id="l-map"
                          style="
                            height: 300px;
                            position: absolute;
                            width: 70%;
                            z-index: 1000;
                          "
                        ></div>
                      </el-col>
                    </el-row>

                    <!-- 获取当前地址  -->
                    <div id="allmap"></div>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="typeId" label="工程类型：">
                    <el-select
                      clearable
                      filterable
                      placeholder="请选择"
                      class="proInputWidth"
                      v-model="formData.typeId"
                    >
                      <el-option
                        v-for="item in typeId"
                        :key="item.code"
                        :label="item.name"
                        :value="item.code"
                      >
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12" v-if="isWhUser()">
                  <el-form-item
                    prop="isStateOwnedConstruction"
                    label="是否国企施工项目："
                    :rules="
                      isNeedIsStateOwned == 0
                        ? [{ required: false }]
                        : formRules.isStateOwnedConstruction
                    "
                  >
                    <el-select
                      clearable
                      filterable
                      placeholder="请选择项目的施工总承包企业是否属于国有企业"
                      class="proInputWidth"
                      v-model="formData.isStateOwnedConstruction"
                    >
                      <el-option label="是" value="1"></el-option>
                      <el-option label="否" value="0"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    prop="constructLocation"
                    label="施工地址："
                    :rules="
                      isNeedConstructLocation == 0
                        ? [{ required: false }]
                        : formRules.constructLocation
                    "
                  >
                    <el-input
                      v-model.trim="formData.constructLocation"
                      placeholder="请输入施工详细地址"
                      class="proInputWidth"
                      clearable
                      @blur="formData.constructLocation = changeValue($event)"
                    ></el-input>
                    <!-- <textarea name="" id="" cols="10" rows="1" v-model.trim="formData.constructLocation" placeholder="请输入施工详细地址" class = "proInputWidth" clearable @blur="formData.constructLocation = changeValue($event)"></textarea> -->
                  </el-form-item>
                </el-col>
                <!-- </el-row>
                            <el-row> -->
                <el-col :span="12">
                  <el-form-item prop="salaryDay" label="工资发放日：">
                    <el-select
                      placeholder="请选择"
                      v-model="formData.salaryDay"
                      class="proInputWidth"
                      clearable
                      filterable
                    >
                      <el-option
                        v-for="(item, index) in 31"
                        :key="index"
                        :value="item"
                        :label="item"
                      ></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12" v-if="isXiangYangUser()">
                  <el-form-item
                    label="合同签订日："
                    prop="contractSignDate"
                    :rules="
                      isNeedContractSignDate == 0
                        ? [{ required: false }]
                        : formRules.contractSignDate
                    "
                  >
                    <el-date-picker
                      type="date"
                      placeholder="请选择"
                      v-model="formData.contractSignDate"
                      value-format="yyyy-MM-dd"
                      class="proInputWidth"
                      clearable
                    ></el-date-picker>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row v-if="isWhUser()">
                <el-col :span="24">
                  <el-form-item label="施工许可证：">
                    <uploadAnnex
                      @getFileList="getFileListLicense"
                      :limitationFactor="limitationFactorLicense"
                      @getFile="getFileLicense"
                      :upLoadFile="upLoadFileLicense"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <uploadResult
                    style="margin-left: 120px"
                    :resultList="upLoadFileLicense"
                    @callBackResult="getFileLicense"
                  />
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item
                    label="开工令："
                    class="upLoadDomContainer"
                    :rules="
                      isNeedOrdFiles == 0
                        ? [{ required: false }]
                        : formRules.upLoadFileOrder
                    "
                    prop="upLoadFileOrder"
                  >
                    <uploadAnnex
                      @getFileList="getFileListOrder"
                      :limitationFactor="limitationFactorOrder"
                      @getFile="getFileOrder"
                      :upLoadFile="upLoadFileOrder"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <uploadResult
                    style="margin-left: 120px"
                    :resultList="upLoadFileOrder"
                    @callBackResult="getFileOrder"
                  />
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col>
            <div class="secondaryTitle secondaryTitleTheme mrB30 mrT24">
              建设方信息
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content bg-purple">
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="pcName" label="单位名称：">
                    <el-input
                      v-model.trim="formData.pcName"
                      @change="
                        validUsccAndCompany(formData.pcName, formData.pcUscc)
                      "
                      placeholder="请输入单位名称"
                      class="proInputWidth"
                      clearable
                    ></el-input>
                    <!-- <span>{{formData.pcName}}</span> -->
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item prop="pcUscc" label="统一社会信用代码：">
                    <el-input
                      v-model.trim="formData.pcUscc"
                      @change="
                        validUsccAndCompany(formData.pcName, formData.pcUscc)
                      "
                      placeholder="请输入统一社会信用代码"
                      class="proInputWidth"
                      clearable
                    ></el-input>
                    <!-- <span>{{formData.pcUscc}}</span> -->
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item
                    prop="pcLeader"
                    :rules="
                      isNeedPcLeader == 0
                        ? [{ required: false }]
                        : formRules.pcLeader
                    "
                  >
                    <span slot="label">
                      项目负责人<el-tooltip
                        content="Top center"
                        placement="top"
                        effect="dark"
                      >
                        <div slot="content">业主单位负责管理该项目的人员</div>
                        <i
                          class="icon iconfont iconhuabanfuben"
                        ></i> </el-tooltip
                      >：
                    </span>
                    <el-input
                      v-model.trim="formData.pcLeader"
                      placeholder="请输入项目全权负责人姓名"
                      class="proInputWidth"
                      clearable
                    ></el-input>
                    <!-- <el-tooltip content="Top center" placement="top" effect="dark">
                                            <div slot="content">
                                            业主单位负责管理该项目的人员
                                            </div>
                                            <i class="icon iconfont iconhuabanfuben"></i>
                                        </el-tooltip> -->
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    label="负责人手机号码："
                    prop="pcLeaderTel"
                    :rules="
                      isNeedPcLeaderTel == 0
                        ? [{ required: false }]
                        : formRules.pcLeaderTel
                    "
                  >
                    <el-input
                      v-model.trim="formData.pcLeaderTel"
                      placeholder="请输入项目全权负责人手机号码"
                      class="proInputWidth"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col>
            <div class="secondaryTitle secondaryTitleTheme mrB30 mrT24">
              施工方信息
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content bg-purple">
              <el-row>
                <el-col :span="12">
                  <el-form-item prop="pbName" label="单位名称：">
                    <el-input
                      v-model.trim="formData.pbName"
                      @change="
                        validUsccAndCompany(formData.pbName, formData.pbUscc)
                      "
                      placeholder="请输入单位名称"
                      class="proInputWidth"
                      clearable
                    ></el-input>
                    <!-- <span>{{formData.pbName}}</span> -->
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item prop="pbUscc" label="统一社会信用代码：">
                    <el-input
                      v-model.trim="formData.pbUscc"
                      @change="
                        validUsccAndCompany(formData.pbName, formData.pbUscc)
                      "
                      placeholder="请输入统一社会信用代码"
                      class="proInputWidth"
                      clearable
                    ></el-input>
                    <!-- <span>{{formData.pbUscc}}</span> -->
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item
                    prop="leader"
                    label="项目负责人："
                    :rules="
                      isNeedLeader == 0
                        ? [{ required: false }]
                        : formRules.leader
                    "
                  >
                    <span slot="label">
                      项目负责人<el-tooltip
                        content="Top center"
                        placement="top"
                        effect="dark"
                      >
                        <div slot="content">
                          施工单位负责管理项目的人员，建档后项目账号将发送至负责人手机号
                        </div>
                        <i
                          class="icon iconfont iconhuabanfuben"
                        ></i> </el-tooltip
                      >：
                    </span>
                    <el-input
                      v-model.trim="formData.leader"
                      placeholder="请输入项目全权负责人姓名"
                      class="proInputWidth"
                      clearable
                    ></el-input>
                    <!-- <el-tooltip content="Top center" placement="top" effect="dark">
                                            <div slot="content">
                                            施工单位负责管理项目的人员，建档后项目账号将发送至负责人手机号
                                            </div>
                                            <i class="icon iconfont iconhuabanfuben"></i>
                                        </el-tooltip> -->
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    prop="leaderTel"
                    label="负责人手机号码："
                    :rules="
                      isNeedLeaderTel == 0
                        ? [{ required: false }]
                        : formRules.leaderTel
                    "
                  >
                    <el-input
                      v-model.trim="formData.leaderTel"
                      placeholder="请输入项目全权负责人手机号码"
                      class="proInputWidth"
                      clearable
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col>
            <div class="secondaryTitle secondaryTitleTheme mrB30 mrT24">
              项目经理信息
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content bg-purple">
              <el-row>
                <el-col :span="12">
                  <el-form-item
                    prop="managerName"
                    label="姓名："
                    :rules="
                      isNeedManagerName == 1
                        ? formRules.managerName
                        : { required: false, trigger: 'blur' }
                    "
                  >
                    <el-input
                      maxlength="200"
                      v-model.trim="formData.managerName"
                      placeholder="请输入姓名"
                      class="proInputWidth"
                      clearable
                      filterable
                    ></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item
                    prop="managerIdcard"
                    label="身份证号："
                    :rules="
                      isNeedManagerIdcard == 0
                        ? [
                            {
                              required: false,
                              pattern:
                                /^(([1-9][0-9]{5}(19|20)[0-9]{2}((0[1-9])|(1[0-2]))([0-2][1-9]|10|20|30|31)[0-9]{3}([0-9]|X|x))|([1-9][0-9]{5}[0-9]{2}((0[1-9])|(1[0-2]))([0-2][1-9]|10|20|30|31)[0-9]{3}))$/,
                              message: '请输入正确的身份证号',
                              trigger: 'blur',
                            },
                          ]
                        : formRules.managerIdcard
                    "
                  >
                    <el-input
                      v-model.trim="formData.managerIdcard"
                      placeholder="请输入身份证号码"
                      class="proInputWidth"
                      clearable
                      filterable
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="12">
                  <el-form-item
                    prop="managerTel"
                    label="手机号："
                    :rules="
                      isNeedManagerTel == 0
                        ? [
                            {
                              required: false,
                              pattern: /^1[3456789]\d{9}$/,
                              message: '请输入正确的手机号码',
                              trigger: 'blur',
                            },
                          ]
                        : formRules.managerTel
                    "
                  >
                    <el-input
                      v-model.trim="formData.managerTel"
                      placeholder="请输入手机号"
                      class="proInputWidth"
                      clearable
                      filterable
                    ></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item
                    label="项目经理资格证书："
                    prop="managerUpLoadFile"
                    :rules="
                      isNeedMgFiles == 0
                        ? [{ required: false }]
                        : formRules.managerUpLoadFile
                    "
                  >
                    <uploadAnnex
                      @getFileList="getFileList"
                      :limitationFactor="limitationFactor"
                      @getFile="getFile"
                      :upLoadFile="managerUpLoadFile"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row v-if="managerUpLoadFile.length > 0">
                <el-col :span="24" v-model="formData.managerImgUrl">
                  <uploadResult
                    style="margin-left: 120px"
                    :resultList="managerUpLoadFile"
                    @callBackResult="getFile"
                  />
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <el-form-item
                    label="项目经理企业任命文件："
                    prop="manUploadFiles"
                    class="manUploads"
                    :rules="
                      isAppointJson == 0
                        ? [{ required: false }]
                        : formRules.manUploadFiles
                    "
                  >
                    <uploadAnnex
                      @getFileList="getFileListManFiles"
                      :limitationFactor="limitationFactorManFiles"
                      @getFile="getFileManFiles"
                      :upLoadFile="manUploadFiles"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24">
                  <uploadResult
                    style="margin-left: 120px"
                    :resultList="manUploadFiles"
                    @callBackResult="getFileManFiles"
                  />
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <el-divider></el-divider>
        <el-row>
          <el-col>
            <div class="secondaryTitle secondaryTitleTheme mrB30 mrT24">
              合同信息
            </div>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <div class="grid-content bg-purple">
              <el-row>
                <el-col :span="24">
                  <el-form-item
                    label="合同附件："
                    :rules="
                      isNeedUpLoadFile == 0
                        ? [{ required: false }]
                        : formRules.upLoadFile
                    "
                    prop="upLoadFile"
                  >
                    <uploadAnnex
                      @getFileList="getFileListTwo"
                      :limitationFactor="limitationFactorTwo"
                      @getFile="getFileTwo"
                      :upLoadFile="upLoadFile"
                    />
                  </el-form-item>
                </el-col>
              </el-row>
              <el-row>
                <el-col :span="24" v-model="formData.contractImgUrl">
                  <uploadResult
                    style="margin-left: 120px"
                    :resultList="upLoadFile"
                    @callBackResult="getFileTwo"
                  />
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
        <el-row
          style="text-align: center; margin-top: 20px; margin-bottom: 40px"
        >
          <el-col :span="24">
            <!-- <el-form-item> -->
            <el-button
              class="commonBut saveBtn"
              type="primary"
              v-sdc
              @click="saveToDetail"
              v-show="isShowUpdate"
              :loading="isSaveLoading"
              >保存</el-button
            >
            <!-- </el-form-item> -->
          </el-col>
        </el-row>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: 'companyProjectInfoUpd',

  data() {
    // 验证建设周期
    var validateConCycle = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('建设周期不能为空'))
      } else {
        var ConCycle = /^\+?[1-9]\d*$/
        if (!ConCycle.test(value)) {
          callback(new Error('建设周期必须是正整数'))
        } else {
          if (value >= 36500) {
            callback(new Error('建设周期不能大于36500天'))
          } else {
            callback()
          }
        }
      }
    }
    var validAddress = (rule, value, callback) => {
      var that = this
      var address = that.formData.detailAddress.replace(/\s/g, '')
      setTimeout(function () {
        if (!that.lat || !address) {
          return callback(new Error('请输入有效地址'))
        } else {
          callback()
        }
      }, 500)
    }
    //验证企业名称
    var validateName = (rule, value, callback) => {
      value = value.replace(/\s+/g, '')
      if (value === '') {
        callback(new Error('企业名称不能为空'))
      } else {
        if (value.length > 100) {
          callback(new Error('企业名称不能超过100个字符'))
        } else {
          if (this.formData.jsUscc !== '') {
            this.$refs.formData.validateField('jsUscc')
          }

          callback()
        }
      }
    }
    //验证uscc
    var validateUscc = (rule, value, callback) => {
      value = value.replace(/\s+/g, '')
      if (value === '') {
        callback(new Error('统一社会信用代码不能为空'))
      } else {
        var regUscc = /^[0-9A-Z]{2}[0-9]{6}[0-9A-Z]{10}$/
        if (!regUscc.test(value)) {
          callback(new Error('统一社会信用代码格式不正确'))
        } else {
          var companyName = this.formData.unitName
          if (this.jsFlag == '') {
            this.validUscc(companyName, value, callback)
          } else {
            if (
              (this.jsName != companyName ||
                this.jsUscc != value ||
                this.jsFlag == '2') &&
              this.saveFlag == '1'
            ) {
              this.validUscc(companyName, value, callback)
            } else {
              callback()
            }
          }
        }
      }
    }
    var validateManagerUpLoadFile = (rele, value, callback) => {
      if (this.managerUpLoadFile.length < 1) {
        return callback(new Error('必须上传项目经理资格证书'))
      } else {
        callback()
      }
    }
    var validateConAddress = (rule, value, callback) => {
      value = value.toString().replace(/\s+/g, '')
      if (value === '') {
        callback(new Error('请输入施工地址'))
      } else {
        if (value.length > 50) {
          callback(new Error('施工地址最多可输入50字'))
        } else {
          callback()
        }
      }
    }
    var checkUpLoadFileOrder = (rule, value, callback) => {
      if (this.upLoadFileOrder.length == 0) {
        return callback(new Error('请上传开工令附件'))
      } else {
        callback()
      }
    }
    // 武汉施工许可证
    var checkUpLoadFileLicense = (rule, value, callback) => {
      if (this.upLoadFileLicense.length == 0) {
        return callback(new Error('请上传施工许可证'))
      } else {
        callback()
      }
    }
    // 合同附件
    var checkUpLoadFile = (rule, value, callback) => {
      if (this.upLoadFile.length == 0) {
        return callback(new Error('请上传合同附件'))
      } else {
        callback()
      }
    }
    var validateManUploadFiles = (rule, value, callback) => {
      if (this.manUploadFiles.length == 0) {
        return callback(new Error('请上传项目经理企业任命文件'))
      } else {
        callback()
      }
    }
    return {
      limitationFactor: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传文件最大数量设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'managerFiles', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'managerFilesForm', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip:
          '请上传项目项目经理资质证书，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      limitationFactorTwo: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'salaryExcel', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'salaryExcelForm', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip:
          '请上传项目合同（必须包含项目名称、甲乙双方、工程造价、工期等必要内容），附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      // 施工许可证
      limitationFactorLicense: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'license', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'licenseForm', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip:
          '请上传施工许可证，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      // 开工令
      limitationFactorOrder: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'startOrder', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'startOrderForm', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip:
          '请上传开工令，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      // 任命书
      limitationFactorManFiles: {
        uploadAnnexUrl: 'api-f/files/upload', //自定义上传文件接口地址
        upLoadFileLength: 10, //自定义上传附件的个数设置
        fileSize: 5, //自定义上传文件最大设置
        formatType: 'typeFour', //自定义上传格式校验类型
        fileId: 'manUploadFiles', //自定义id解决一个页面包含多个上传附件
        uploadFormId: 'manFilesForm', //自定义id解决一个页面包含多个上传附件
        messagetip:
          '要求格式为png，jpg，jpeg，doc，docx，xls，xlsx，pdf格式，附件大小不超过5M', //自定义报错提示语
        methodTip:
          '请上传项目经理任命书，附件格式支持png，jpg，jpeg，doc，docx，xls，xlsx，pdf，最多上传10个附件', //自定义上传文件提示
        uploadBtnType: 'typeOne', //自定义上传按钮类型
      },
      projectStatus: [],
      formData: {
        projectName: '', //项目名称
        license: '', // 施工许可证
        startDate: '', //开工日期
        typeId: '', //工程类型
        constructionCycle: '', //建设周期
        detailAddress: '', //详细地址
        salaryDay: '', //工资发放日
        practiceCertificate: '', //执业证书
        certificateNum: '', //证书编号
        contractImgUrl: [],
        leader: '',
        leaderTel: '',
        pcName: '',
        pcUscc: '',
        pbName: '',
        pbUscc: '',
        pcLeader: '',
        pcLeaderTel: '',
        managerIdcard: '',
        managerName: '',
        managerTel: '',
        constructLocation: '', //施工地址
        isStateOwnedConstruction: '',
        contractSignDate: '',
      },
      projectName: '',
      formRules: {
        isStateOwnedConstruction: [
          {
            required: true,
            message: '请选择项目的施工总承包企业是否属于国有企业',
            trigger: 'change',
          },
        ],
        pcLeader: [
          { required: true, message: '请输入项目负责人', trigger: 'blur' },
        ],
        pcLeaderTel: [
          { required: true, message: '请输入负责人手机号码', trigger: 'blur' },
        ],
        typeId: [
          {
            required: true,
            message: '工程类型不能为空',
            trigger: 'change',
          },
        ],
        projectName: [
          {
            required: true,
            message: '项目名称不能为空',
            trigger: 'blur',
          },
        ],
        startDate: [
          {
            required: true,
            message: '开工日期不能为空',
            trigger: 'change',
          },
        ],
        salaryDay: [
          {
            required: true,
            message: '工资发放日不能为空',
            trigger: 'change',
          },
        ],
        constructionCycle: [
          {
            required: true,
            validator: validateConCycle,
            trigger: 'blur',
          },
        ],
        detailAddress: [
          {
            required: true,
            validator: validAddress,
            trigger: 'change',
          },
        ],
        managerName: [
          {
            required: true,
            message: '项目经理姓名不能为空',
            trigger: 'blur',
          },
        ],
        managerIdcard: [
          {
            required: true,
            pattern:
              /^(([1-9][0-9]{5}(19|20)[0-9]{2}((0[1-9])|(1[0-2]))([0-2][1-9]|10|20|30|31)[0-9]{3}([0-9]|X|x))|([1-9][0-9]{5}[0-9]{2}((0[1-9])|(1[0-2]))([0-2][1-9]|10|20|30|31)[0-9]{3}))$/,
            message: '请输入正确的身份证号',
            trigger: 'blur',
          },
        ],
        managerTel: [
          {
            required: true,
            pattern: /^1[3456789]\d{9}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur',
          },
        ],
        leader: [
          {
            required: true,
            message: '项目全权负责人姓名不能为空',
            trigger: 'blur',
          },
        ],
        leaderTel: [
          {
            required: true,
            pattern: /^1[3456789]\d{9}$/,
            message: '请输入正确的手机号码',
            trigger: 'blur',
          },
        ],
        pcName: [
          { required: true, validator: validateName, trigger: 'change' },
        ],
        pcUscc: [
          { required: true, validator: validateUscc, trigger: 'change' },
        ],
        pbName: [
          { required: true, validator: validateName, trigger: 'change' },
        ],
        pbUscc: [
          { required: true, validator: validateUscc, trigger: 'change' },
        ],
        managerUpLoadFile: [
          {
            required: true,
            validator: validateManagerUpLoadFile,
            trigger: 'change',
          },
        ],
        constructLocation: [
          { required: true, validator: validateConAddress, trigger: 'blur' },
        ],
        upLoadFileOrder: [
          {
            required: true,
            validator: checkUpLoadFileOrder,
            trigger: 'blur',
          },
        ],
        contractSignDate: [
          { required: true, message: '请选择合同签订日', trigger: 'change' },
        ],
        upLoadFileLicense: [
          {
            required: true,
            validator: checkUpLoadFileLicense,
            trigger: 'blur',
          },
        ],
        upLoadFile: [
          {
            required: true,
            validator: checkUpLoadFile,
            trigger: 'blur',
          },
        ],
        manUploadFiles: [
          {
            required: true,
            validator: validateManUploadFiles,
            trigger: 'change',
          },
        ],
      },
      isShowMap: false, //是否显示地图
      lon: '',
      lat: '',
      LocationPoint: '',
      isShowBox: true,
      selectData: '',
      projectType: [], //工程类型
      startStatus: 'startStatus', //状态样式
      statusDesc: '',

      status: '',
      areaName: '',
      industryName: '',
      investmentDesc: '',
      total: '',
      typeId: [], //工程类型

      projectId: '',
      companyType: '',
      isSaveLoading: false, // 保存loading
      upLoadFile: [], //附件
      srcList: [],
      oldSrcList: [],
      managerUpLoadFile: [], //项目经理资质附件
      managerSrcList: [],
      managerOldSrcList: [],
      upLoadFileLicense: [], //施工许可证附件
      srcListLicense: [],
      oldSrcListLicense: [],
      upLoadFileOrder: [], //开工令附件
      srcListOrder: [],
      oldSrcListOrder: [],
      isShowUpdate: '',
      list: [],
      isNeedLicense: '', //施工许可证
      isNeedOrdFiles: '', //开工令附件
      isNeedUpLoadFile: '', //合同附件
      isNeedManagerName: '', //项目经理姓名
      isNeedManagerIdcard: '', //项目经理身份证号
      isNeedManagerTel: '', //项目经理手机号码
      isNeedMgFiles: '', //项目经理资格证书
      isAppointJson: '', //项目经理任命文件
      isNeedIsStateOwned: '', //是否国企施工项目
      isNeedContractSignDate: '', //合同签订日
      isNeedLicenseFiles: '', //武汉施工许可证
      manFilesOldSrcList: [], //任命书
      manFilesSrcList: [],
      manUploadFiles: [],
      isNeedAddress: '', //详细地址
      isNeedConstructLocation: '', //施工地址
      isNeedPcLeader: '', //建设方负责人
      isNeedPcLeaderTel: '', //建设方负责人手机号
      isNeedLeader: '',
      isNeedLeaderTel: '',
    }
  },
  computed: {
    daySelct() {
      var daySelct = []
      for (var i = 1; i <= 31; i++) {
        var obj = {}
        obj.value = i
        obj.label = i
        daySelct.push(obj)
      }
      return daySelct
    },
  },
  async created() {
    await this.getIsNeed() //是否必填
    this.projectId = this.$route.query.pr
    this.projectId = this.$route.query.projectId
    this.companyType = this.$route.query.companyType
    this.getSelecData('PROJECT_TYPE')
    //初始化信息
    this.getInitInfo()
    this.isShowUpdate =
      this.$store.state.buttonLimitsArr.indexOf('mProjectList:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('projectList:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('projectListJSF:update') > -1 ||
      this.$store.state.buttonLimitsArr.indexOf('projectListSGF:update') > -1
  },
  mounted() {
    this.$nextTick(function () {
      this.getLocation()
      setTimeout(function () {
        if ($('.topContent').outerHeight() - 69 > 0) {
          $('.mainCon').css(
            'top',
            198 + ($('.topContent').outerHeight() - 69) + 'px'
          ).marginTop
        }
      }, 500)
    })
  },
  methods: {
    getSelecData(type) {
      var url
      url = 'api-bs/base/dicitem/findbytype'
      this.axios({
        method: 'post',
        url: url,
        data: { type: type },
      })
        .then((res) => {
          this.typeId = res.data.result
        })
        .catch((error) => {
          this.$message({
            showClose: true,
            duration: 3000,
            message: '获取数据失败',
            type: 'error',
          })
        })
    },
    /**
     * @description: 获取上传的附件
     */
    getFile(val) {
      this.managerUpLoadFile = val
    },
    /**
     * @description: 获取上传的附件
     */
    getFileList(val) {
      this.managerOldSrcList.push(val)
      this.managerSrcList.push(val)
    },
    /**
     * @description: 获取上传的附件
     */
    getFileTwo(val) {
      this.upLoadFile = val
    },
    /**
     * @description: 获取上传的附件
     */
    getFileListTwo(val) {
      this.oldSrcList.push(val)
      this.srcList.push(val)
    },
    goBack() {
      this.$router.push({
        path: '/home/monitorProjectManagement/projectDetail',
        name: 'projectDetail',
        query: {
          projectId: this.projectId,
          companyType: this.companyType,
        },
      })
      this.$store.commit('GOBACK_NAME', {
        oldUrl: '/home/project/projectListQY',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
    getInitInfo() {
      this.isSaveLoading = true
      this.axios({
        method: 'post',
        url: 'api-p/project/expand/initdata',
        data: {
          id: this.projectId,
        },
      }).then((response) => {
        if (!response.data.hasError) {
          this.isSaveLoading = false
          var data = response.data.result
          this.lon = data.lon
          this.lat = data.lat
          this.formData.projectName = data.projectName
          this.formData.license = data.license
          this.formData.startDate = data.startDate
          this.formData.salaryDay = data.salaryDay
          this.formData.constructionCycle = data.cycle
          this.formData.detailAddress = data.address
          this.statusDesc = data.statusDesc
          this.status = data.status
          this.areaName = data.areaName
          this.industryName = data.industryName
          this.investmentDesc = data.investmentDesc
          this.total = data.total
          this.projectName = data.projectName
          this.upLoadFile = data.contractFiles
          this.formData.typeId = data.typeId //工程类型
          this.formData.leader = data.leader //---项目负责人
          this.formData.leaderTel = data.leaderTel //---项目负责人电话
          this.formData.pcName = data.pcName
          this.formData.pcUscc = data.pcUscc
          this.formData.pbName = data.pbName
          this.formData.pbUscc = data.pbUscc
          this.formData.pcLeader = data.pcLeader
          this.formData.pcLeaderTel = data.pcLeaderTel
          this.managerUpLoadFile = data.manFiles
          this.upLoadFileLicense = data.licenseFilesView || [] //施工许可证
          this.upLoadFileOrder = data.orFiles //开工令
          this.formData.managerIdcard = data.managerIdcard
          this.formData.managerName = data.managerName
          this.formData.managerTel = data.managerTel
          this.formData.constructLocation = data.constructLocation
          this.formData.contractSignDate = data.contractSignDate
          this.manUploadFiles = data.appointFiles

          if (this.upLoadFile.length > 0) {
            for (var i = 0; i < this.upLoadFile.length; i++) {
              this.srcList.push(this.upLoadFile[i].url)
              this.oldSrcList.push(this.upLoadFile[i].url)
            }
          }
          if (this.managerUpLoadFile.length > 0) {
            for (var i = 0; i < this.managerUpLoadFile.length; i++) {
              this.managerSrcList.push(this.managerUpLoadFile[i].url)
              this.managerOldSrcList.push(this.managerUpLoadFile[i].url)
            }
          }
          if (this.upLoadFileOrder.length > 0) {
            for (var i = 0; i < this.upLoadFileOrder.length; i++) {
              this.srcListOrder.push(this.upLoadFileOrder[i].url)
              this.oldSrcListOrder.push(this.upLoadFileOrder[i].url)
            }
          }
          if (this.manUploadFiles.length > 0) {
            for (var i = 0; i < this.manUploadFiles.length; i++) {
              this.manFilesSrcList.push(this.manUploadFiles[i].url)
              this.manFilesOldSrcList.push(this.manUploadFiles[i].url)
            }
          }
          this.formData.isStateOwnedConstruction = data.isStateOwnedConstruction
            ? data.isStateOwnedConstruction
            : ''
          //武汉地区需求
          if (!this.isWhUser()) {
            delete this.formRules.isStateOwnedConstruction
          }
          this.$nextTick(() => {
            this.$refs.formData.clearValidate()
          })
        } else {
          this.isSaveLoading = false
        }
      })
      // .catch(error => {
      //     this.isSaveLoading = false;
      //     this.$message.error("数据获取失败");
      // });
    },
    saveToDetail() {
      this.$refs.formData.validate((valid) => {
        if (valid) {
          // 保存更新
          this.isSaveLoading = true
          this.submitFormUptate()
        } else {
          return false
        }
      })
    },
    submitFormUptate() {
      var data = {
        id: this.projectId,
        lon: this.lon,
        lat: this.lat,
        projectName: this.formData.projectName,
        license: this.formData.license,
        startDate: this.formData.startDate,
        salaryDay: this.formData.salaryDay,
        cycle: this.formData.constructionCycle,
        address: this.formData.detailAddress,
        status: this.status,
        leader: this.formData.leader,
        leaderTel: this.formData.leaderTel, //---项目负责人电话
        files: JSON.stringify(this.upLoadFile), //---项目合同附件
        pcName: this.formData.pcName, //建设方单位名称
        pcUscc: this.formData.pcUscc, //建设方统一社会信用代码
        pbName: this.formData.pbName, //施工方单位名称
        pbUscc: this.formData.pbUscc, //施工方统一社会信用代码\
        managerName: this.formData.managerName,
        managerIdcard: this.formData.managerIdcard,
        managerTel: this.formData.managerTel,
        pcLeader: this.formData.pcLeader, //---建设方项目负责人
        pcLeaderTel: this.formData.pcLeaderTel, //---建设方项目负责人电话
        mgFiles: JSON.stringify(this.managerUpLoadFile), //项目经理资格证书
        licenseFiles: JSON.stringify(this.upLoadFileLicense), //施工许可证
        ordFiles: JSON.stringify(this.upLoadFileOrder), //开工令
        constructLocation: this.formData.constructLocation,
        contractSignDate: this.formData.contractSignDate,
        appointJson: JSON.stringify(this.manUploadFiles),
      }
      //武汉地区
      data.isStateOwnedConstruction = this.formData.isStateOwnedConstruction
      this.axios({
        method: 'post',
        url: 'api-p/project/expand/cprojectedit',
        data: data,
      })
        .then((response) => {
          this.isSaveLoading = false
          if (!response.data.hasError) {
            this.$message({
              message: '保存成功',
              type: 'success',
            })
            this.$router.push({
              path: '/home/monitorProjectManagement/projectDetail',
              name: 'projectDetail',
              query: {
                projectId: this.projectId,
                companyType: this.companyType,
              },
            })
            this.$store.commit('CHANGE_SLIDER_NAME', {
              oldUrl: '/home/project/projectListQY',
              newUrl: this.$router.currentRoute.fullPath,
            })
          } else {
            this.$message({
              type: 'error',
              message: response.data.errorMsg,
            })
            this.isSaveLoading = false
          }
        })
        .catch((error) => {
          this.$message.error('保存失败')
          this.isSaveLoading = false
        })
    },
    getLocation() {
      var that = this
      var map = new BMap.Map('allmap')

      function myFun(result) {
        var cityName = result.name
        map.setCenter(cityName)
        that.LocationPoint = cityName
      }
      var myCity = new BMap.LocalCity()
      myCity.get(myFun)
    },
    showMap() {
      this.isShowMap = true
      this.isShowBox = false
      var addressName = this.formData.detailAddress
      this.$nextTick(function () {
        // 详细地址获取焦点
        this.$refs.inputDetailAdr.focus()
        this.initMap()
        setTimeout(function () {
          if ($('.tangram-suggestion-main').length == 1) {
            $('#suggestId').val(addressName)
          }
        }, 50)
        $('#suggestId').val(addressName)
      })
    },
    hideMap() {
      var that = this
      setTimeout(function () {
        if (that.selectData == '1') {
          that.isShowMap = true
          that.selectData = ''
          that.isShowBox = false
        } else {
          that.isShowMap = false
          that.isShowBox = true
        }
      }, 500)
    },
    initMap() {
      var that = this
      // 百度地图API功能
      function G(id) {
        return document.getElementById(id)
      }

      var map = new BMap.Map('l-map')
      if (that.formData.detailAddress) {
        that.isShowMap = true
        this.isShowBox = false

        var point = new BMap.Point(that.lon, that.lat)

        map.centerAndZoom(point, 16)

        var mk = new BMap.Marker(point)
        map.addOverlay(mk)
        map.panTo(point)
      } else {
        var myGeo = new BMap.Geocoder()
        // 将地址解析结果显示在地图上,并调整地图视野
        myGeo.getPoint(
          that.LocationPoint,
          function (point) {
            if (point) {
              map.centerAndZoom(point, 16)

              var mk = new BMap.Marker(point)

              map.addOverlay(mk)
              map.panTo(point)
            } else {
              // alert("您选择地址没有解析到结果!");
            }
          },
          '北京市'
        )
      }
      //增加滚轮放大缩小
      map.enableScrollWheelZoom(true)

      //增加滚轮放大缩小
      var ac = new BMap.Autocomplete({
        //建立一个自动完成的对象
        input: 'suggestId',
        location: map,
      })

      ac.addEventListener('onhighlight', function (e) {
        // that.selectData = "1";
        //鼠标放在下拉列表上的事件
        var str = ''
        var _value = e.fromitem.value
        var value = ''
        if (e.fromitem.index > -1) {
          value =
            _value.province +
            _value.city +
            _value.district +
            _value.street +
            _value.business
        }
        str =
          'FromItem<br />index = ' + e.fromitem.index + '<br />value = ' + value

        value = ''
        if (e.toitem.index > -1) {
          _value = e.toitem.value
          value =
            _value.province +
            _value.city +
            _value.district +
            _value.street +
            _value.business
        }
        str +=
          '<br />ToItem<br />index = ' +
          e.toitem.index +
          '<br />value = ' +
          value
        G('searchResultPanel').innerHTML = str
      })

      var myValue
      ac.addEventListener('onconfirm', function (e) {
        that.selectData = '1'
        //鼠标点击下拉列表后的事件
        var _value = e.item.value
        myValue =
          _value.province +
          _value.city +
          _value.district +
          _value.street +
          _value.business
        G('searchResultPanel').innerHTML =
          'onconfirm<br />index = ' +
          e.item.index +
          '<br />myValue = ' +
          myValue
        that.formData.detailAddress = myValue
        setPlace()
      })

      function setPlace() {
        map.clearOverlays() //清除地图上所有覆盖物
        function myFun() {
          var pp = local.getResults().getPoi(0).point //获取第一个智能搜索的结果
          map.centerAndZoom(pp, 18)
          var marker = new BMap.Marker(pp)
          map.addOverlay(marker) //添加标注
          that.lon = pp.lng
          that.lat = pp.lat
          var geoc = new BMap.Geocoder()
        }
        var local = new BMap.LocalSearch(map, {
          //智能搜索
          onSearchComplete: myFun,
        })
        local.search(myValue)
      }
    },
    validProName() {
      if (this.formData.projectName) {
        this.axios({
          method: 'post',
          url: 'api-p/project/expand/validatename',
          data: {
            name: this.formData.projectName,
            id: this.projectId,
          },
        })
          .then((resp) => {
            if (resp.data.hasError) {
              this.$message({
                showClose: true,
                duration: 3000,
                message: resp.data.errorMsg,
                type: 'error',
              })
            }
          })
          .catch((resp) => {})
      }
    },
    //施工许可证
    getFileListLicense(val) {
      this.oldSrcListLicense.push(val)
      this.srcListLicense.push(val)
    },
    getFileLicense(val) {
      this.upLoadFileLicense = val
    },
    // 开工令
    getFileListOrder(val) {
      this.oldSrcListOrder.push(val)
      this.srcListOrder.push(val)
    },
    getFileOrder(val) {
      this.upLoadFileOrder = val
    },
    // 项目经理任命书
    getFileListManFiles(val) {
      this.manFilesOldSrcList.push(val)
      this.manFilesSrcList.push(val)
    },
    getFileManFiles(val) {
      this.manUploadFiles = val
    },
    validUsccAndCompany(companyName, uscc) {
      if (companyName && uscc) {
        this.axios({
          method: 'post',
          url: 'api-c/companyaudit/base/validcompanybyproject',
          data: {
            name: companyName.replace(/\s+/g, ''),
            uscc: uscc.replace(/\s+/g, ''),
          },
        })
          .then((res) => {
            if (!res.data.hasError) {
              this.$message({
                message: '已通过校验',
                type: 'success',
              })
            } else {
              if (res.data.errorCode == 'unmatched') {
                this.$message({
                  message: '未通过校验，请确认信息是否准确',
                  type: 'warning',
                })
              }
            }
          })
          .catch((error) => {
            this.$message.error('验证失败')
          })
      }
    },
    getIsNeed() {
      return this.axios({
        method: 'post',
        url: 'api-m/fieldconfig/base/getbymaintype',
        data: {
          mainType: 'PROJECT_BUILD',
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            this.list = response.data.result
            // this.$set(this.listObject,'isNeedManagerTel',element.isNeed)
            this.list.forEach((element) => {
              if (element.code == 'license') {
                //施工许可证
                this.isNeedLicense = element.isNeed
              } else if (element.code == 'ordFiles') {
                //开工令附件
                this.isNeedOrdFiles = element.isNeed
              } else if (element.code == 'isStateOwnedConstruction') {
                //是否国企施工项目
                this.isNeedIsStateOwned = element.isNeed
              } else if (element.code == 'contractSignDate') {
                //合同签订日
                this.isNeedContractSignDate = element.isNeed
              } else if (element.code == 'licenseFiles') {
                //武汉施工许可证
                this.isNeedLicenseFiles = element.isNeed
              } else if (element.code == 'files') {
                //合同附件
                this.isNeedUpLoadFile = element.isNeed
              } else if (element.code == 'managerName') {
                //项目经理姓名
                this.isNeedManagerName = element.isNeed
              } else if (element.code == 'managerIdcard') {
                //项目经理身份证号managerIdcard
                this.isNeedManagerIdcard = element.isNeed
              } else if (element.code == 'managerTel') {
                //项目经理手机号码
                this.isNeedManagerTel = element.isNeed
              } else if (element.code == 'mgFiles') {
                //项目经理资格证书
                this.isNeedMgFiles = element.isNeed
              } else if (element.code == 'appointJson') {
                //项目经理任命文件
                this.isAppointJson = element.isNeed
              } else if (element.code == 'address') {
                this.isNeedAddress = element.isNeed
              } else if (element.code == 'constructLocation') {
                this.isNeedConstructLocation = element.isNeed
              } else if (element.code == 'pcLeader') {
                this.isNeedPcLeader = element.isNeed
              } else if (element.code == 'pcLeaderTel') {
                this.isNeedPcLeaderTel = element.isNeed
              } else if (element.code == 'leader') {
                this.isNeedLeader = element.isNeed
              } else if (element.code == 'leaderTel') {
                this.isNeedLeaderTel = element.isNeed
              }
            })
          } else {
            this.$message.error(response.data.errorMsg)
          }
        })
        .catch((error) => {
          if (error.response) {
            this.$message.error(error.response.data)
          }
        })
    },
  },
  watch: {
    managerUpLoadFile(val) {
      if (val.length > 0) {
        this.$refs.formData.clearValidate('managerUpLoadFile')
      }
    },
    'formData.detailAddress': {
      handler(newVal, oldVal) {
        if (oldVal) {
          if (newVal != oldVal) {
            // this.lon = "";
            // this.lat = ""
          }
        }
      },
      deep: true,
    },
  },
}
</script>

<style lang="less" scoped>
.container {
  .topContent {
    background-color: #fff;
    position: relative;
    padding: 0 24px;
    .salaryTitle {
      padding: 16px 0;
      border-bottom: 1px solid #e3e7e9;
    }
    .statusBox {
      margin-top: 6px;
      display: inline-block;
    }
    .topProjectName {
      font: bold 18px Microsoft YaHei;
      color: #333;
      margin-bottom: 6px;
      line-height: 20px;
    }
    /* 开工状态 */
    .startStatus {
      padding: 2px 8px;
      color: #fff;
      font-size: 12px;
      margin-left: 10px;
      // vertical-align: top;
    }
    .greenBack {
      background: #009588;
    }
    .StartOver {
      background: #657282;
    }
    .noStart {
      background: #ffc100;
    }
    .startStop {
      background: #d9544f;
    }
  }
  .mainCon {
    padding-left: 24px;
    padding-right: 24px;
    .infoTitle {
      font-size: 16px;
      padding: 16px 24px;
      background: #f5f7fb;
      margin-bottom: 24px;
      color: #333;
      font-weight: 700;
    }
    .proInputWidth {
      width: 75%;
    }
  }
  .uploadBox {
    position: relative;
    .uploadImg {
      width: 96px;
      height: 36px;
      color: #009588;
      border: 1px solid #009588;
      line-height: 10px;
      &:hover {
        background: rgba(0, 149, 136, 0.1);
      }
    }
    .uploadImgState {
      font-size: 14px;
      color: #999999;
      margin-left: 12px;
    }
    .upLoadDom {
      position: absolute;
      top: 0;
      left: 0;
      opacity: 0;
      input {
        width: 100px;
        height: 36px;
        cursor: pointer;
      }
    }
  }
  .imgStyle {
    padding-left: 100px;
    margin-top: 24px;
    li {
      position: relative;
      margin-right: 20px;
      margin-top: 10px;
      i {
        position: absolute;
        right: -6px;
        top: -10px;
        font-size: 20px;
      }
    }
  }
}
.manUploads {
  /deep/ .el-form-item__label {
    line-height: normal !important;
  }
}
.ProjectNameBox {
}
</style>
